package com.s3.khospitalds.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.s3.khospitalds.entity.Patientlist;
import com.s3.khospitalds.mapper.PatientlistMapper;
import com.s3.khospitalds.service.PatientlistService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * @Author: xw
 * @CreateTime: 2025/2/25
 * @Description: 处理药方表
 * @Version: 1.0
 */
@Service
public class PatientlistServiceImpl extends ServiceImpl<PatientlistMapper, Patientlist> implements PatientlistService {
    @Autowired
    private PatientlistMapper patientlistMapper;

    @Override
    public List<Patientlist> selectWaitingNumber(int num) {
        return patientlistMapper.selectWaitingNumber(num);
    }

    @Override
    public List<Patientlist> selectPatientNumber(String num) {
        return patientlistMapper.selectPatientNumber(num);
    }

    @Override
    public List<Patientlist> selectWaitingNumber0() {
        return patientlistMapper.selectWaitingNumber0();
    }

    @Override
    public List<Patientlist> selectWaitingNumber2() {
        return patientlistMapper.selectWaitingNumber2();
    }

    @Override
    public List<Patientlist> selectName(String name) {
        return patientlistMapper.selectName(name);
    }

    @Override
    public List<Patientlist> selectNameAndNumber(String number, String name) {
        List<Patientlist> list;
        if (number.equals(" ")) {
            list = patientlistMapper.selectName(name);
        } else if (name.equals(" ")) {
            list = patientlistMapper.selectNumber(number);
        } else {
            list = patientlistMapper.selectNameAndNumber(number, name);
        }
        return list;
    }

    @Override
    public int updateWaitingNumber(String number) {
        return patientlistMapper.updateWaitingNumber(number);
    }

    @Override
    public int updateWaitingNumber2(String number) {
        return patientlistMapper.updateWaitingNumber2(number);
    }

    @Override
    public int updatePharmacist(String pharmacist, String number) {
        return patientlistMapper.updatePharmacist(pharmacist, number);
    }

    @Override
    public int insertPatientList(Patientlist patientlist) {
        return patientlistMapper.insertPatientList(patientlist);
    }

    @Override
    public int updatePatientList(Patientlist patientlist) {
        return patientlistMapper.updatePatientList(patientlist);
    }

    @Override
    public int deletePatientList(String number) {
        return patientlistMapper.deletePatientList(number);
    }

    @Override
    public int insertPatientList2(String date, String number, String name, String sex, int age, String phone, String idCard, String disease, String doctor, String position, String copayFee) {
            // 插入数据
            return patientlistMapper.insertPatientList2(
                    date,
                    number,
                    name,
                    sex,
                    age,
                    phone,
                    idCard,
                    disease,
                    doctor,
                    position,
                    copayFee
            );
    }


    @Override
    public int updateTotalPrice(double price, String number) {
        return patientlistMapper.updateTotalPrice(price, number);
    }


}

